package cn.credit.loan.service.repayment;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.credit.loan.dao.repayment.RepaymentMapper;
import cn.credit.loan.entity.Repayment;
@Service
@Transactional
public class RepaymentServiceImpl implements RepaymentService {
	
	@Autowired
	public RepaymentMapper repaymentMapper;
	/**
	 * 还款记录信息添加
	 */
	@Override
	public boolean getRepaymentAdd(Repayment repayment) throws Exception {
		if(repayment!=null)
		{
			int num=repaymentMapper.getRepaymentAdd(repayment);
			if(num>0)
			{
				return true;
			}
		}
		return false;
	}
	/**
	 * 还款记录信息更新
	 */
	@Override
	public boolean getRepaymentUpdate(Repayment repayment) throws Exception {
		if(repayment!=null)
		{
			int num=repaymentMapper.getRepaymentUpdate(repayment);
			if(num>0)
			{
				return true;
			}
		}
		return false;
	}
	/**
	 * 还款记录信息删除
	 */
	@Override
	public boolean getRepaymentDelete(int repaymentId) throws Exception {
		return repaymentMapper.getRepaymentDelete(repaymentId);
	}

	/**
	 * 还款记录信息查询
	 */
	@Override
	public List<Repayment> getRepaymentList(Repayment repayment) throws Exception {
		List<Repayment> repaymentlist=repaymentMapper.getRepaymentList(repayment);
		if(repaymentlist!=null)
		{
			return repaymentlist;
		}
		return null;
	}

}
